function dS  = CR3BP_n(~,S,u)
    x = S(1);
    y = S(2);
    z = S(3);
    vx = S(4);
    vy = S(5);
    vz = S(6);
    %[] saperate states into each components

    r1 = ((x+u)^2+y^2+z^2)^(1/2);
    r2 = ((x+u-1)^2+y^2+z^2)^(1/2);
    %[] Range of satellite wrt first and second primary bodies.
    
    n = length(S);
    %[] Length of the state vector!
    
    dS = zeros(n,1);
    %[] Pre allocate memory

    dS(1:3) = S(4:6);
    %[] Derivative of the position are the velosity at that time.
    
    dS(4) = x  -  (1-u)*(x+u)/r1^3  -  u*(x+u-1)/r2^3 + 2*vy;
    dS(5) = y  -  (1-u)*y/r1^3 - u*y/r2^3 - 2*vx;
    dS(6) = -(1-u)*z/r1^3-u*z/r2^3;
    %[] Acceleration in the rotating CRTBP frame.

end